package com.huicharge.huichargecrm.controller;


import com.huicharge.huichargecrm.model.dto.ShopInsertDTO;
import com.huicharge.huichargecrm.model.dto.ShopModifyDTO;
import com.huicharge.huichargecrm.result.Result;
import com.huicharge.huichargecrm.service.IAutomobileSalesServiceShopService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 4s店铺 前端控制器
 * </p>
 *
 * @author 小牛
 * @since 2024-12-17
 */
@RestController
@Slf4j
@RequestMapping("/automobilesalesserviceshop")
public class AutomobileSalesServiceShopController {
    @Resource
    private IAutomobileSalesServiceShopService shopService;

    /*
     * 新增4S店
     * */
    @PostMapping("add-automobile-sales-service-shop")
    Result<Boolean> addAutomobileSalesServiceShop(@RequestBody @Valid ShopInsertDTO dto) {
        Boolean isSave = shopService.addAutomobileSalesServiceShop(dto);
        return new Result<>(isSave);
    }

    /*
     * 修改4s店
     * */
    @PostMapping("modify-automobile-sales-service-shop")
    Result<Boolean> modifyAutomobileSalesServiceShop(@RequestBody @Valid ShopModifyDTO dto) {
        Boolean isModify = shopService.modifyAutomobileSalesServiceShop(dto);
        return new Result<>(isModify);
    }

    /*
     * 删除4s店
     * */
    @GetMapping("delete-automobile-sales-service-shop")
    Result<Boolean> deleteAutomobileSalesServiceShop(@RequestParam("id") Integer id) {
        Boolean isDelete = shopService.deleteAutomobileSalesServiceShop(id);
        return new Result<>(isDelete);
    }
    /*
    *根据id查询4s店信息
    * */
/*    @GetMapping()
    Result<> getById(@RequestParam("id") Integer id) {
        return new Result<>(shopService.getById(id));
    }*/
}
